package com.sdu.douban_comment.handler;

import com.sdu.douban_comment.entity.Result;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class BasicExceptionHandler {
    private static final Logger logger= LoggerFactory.getLogger(BasicExceptionHandler.class);

    @ExceptionHandler(value = Exception.class)
    public Result errorHandler(Exception e){
        logger.error(e.getMessage(),e);
        return Result.error(e.getMessage());

    }
}
